<?php
function e($v){
  echo $v . '<br/>';

}
class Actor
{
  public $package = array();
  public $hp = 100;
  public $mp = 100;

  public function  run(){
    echo (" act run.... ");
  }
public function pickup($tools)
  {
    $this->package[] = $tools;
  }
  public function fire($monster){
    echo (" act fire...");
    $monster->hp = $monster->hp -10;
    if($monster->hp>0){
    $monster->fire($this);
  }
}
    public function use_equ(){
      echo ("use...");
    }
      public function be_fire($x){
       $this->hp = $this->hp - $x;
    }

}


class monster
{
  public $hp = 200;

  public function  run(){
    echo (" monster run.... ");
  }
  public function fire($act){
    echo ("monster fire...");


   $act->hp = $act->hp - 5;
 }
}



$act = new Actor;

$monsters=array();
  for ($i=0;$i<10;$i++){
    $monsters[] = new monster;
    //向第一个怪物进攻

    //var_dump($monster);
    for ($i=0;$i<100;$i++){
    if($monsters[0]->hp<=0){
      e("monster death");
      break;
    }
    e("monster hp:".$monsters[0]->hp);
    e("");
    $act->fire ($monsters[0]);
}
  e("act:".$act->hp);
  e("monster:".$monsters[0]->hp);
  e("");

  }
